::脚本需要带一个参数, 是打出的软件包名
echo off
cd  %~dp0

::拷贝各个模块
xcopy /Y "..\\build_release\\%~1%.exe" ".\\bin\\" /s

for /f %%i in ('powershell -c "Get-Date -uformat '%%Y%%m%%d%%H%%M%%S'"') do (
    set "curtime=%%i"
)
echo %curtime%

:: 测试环境放开检测版本
echo %curtime% > debugTimeStamp.txt
xcopy /Y ".\\debugTimeStamp.txt" ".\\bin\\"

::产品文件
xcopy /Y "D:\\WorkshopSDK\\2022\\data_resource\\asset\\*" ".\\bin\\asset\\" /s

::vc运行时库
xcopy /Y "..\\system_dll\\x64\\" ".\\bin\\" /s

::qt相关打包
set PATH=D:/Qt/5.15.2/msvc2019_64/bin;%PATH%
windeployqt --qmldir "D:\\Qt\\5.15.2\\msvc2019_64\\qml" "bin\\%~1%.exe"
del /s /q "bin\\translations"
rd /s /q "bin\\translations"

::添加Qt相关打包信息
type nul > uncopy.txt
echo .pdb > uncopy.txt
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\\qml\\Qt" ".\\bin\\Qt\\" /s
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\\qml\\Qt3D" ".\\bin\\Qt3D\\" /s
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\\qml\\QtQuick" ".\\bin\\QtQuick\\" /s
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\\bin\\Qt5QuickShapes.dll" ".\\bin\\" /s
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\\bin\\Qt5Sql.dll" ".\\bin\\" /s
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\\bin\\Qt5OpenGL.dll" ".\\bin\\" /s
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\\bin\\Qt5Xml.dll" ".\\bin\\" /s
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\\plugins\\renderers\\" ".\\bin\\plugins\\renderers\\" /s
xcopy /Y "D:\\Qt\\5.15.2\\msvc2019_64\\bin\Qt5Concurrent.dll" ".\\bin\\" /s
xcopy /Y "D:\\Qt\\5.15.2\\msvc2019_64\\bin\Qt5QuickWidgets.dll" ".\\bin\\" /s

::删除打包无用信息
rd /s /q "bin\\qmltooling\\"
rd /s /q "bin\\QtMultimedia\\"
rd /s /q "bin\\QtTest\\"
rd /s /q "bin\\QtQuick3D\\"
del /s /q AnySplitCut.dll
del /s /q Punch_r.dll
del /s /q Qt5Multimedia.dll
del /s /q Qt5MultimediaQuick.dll
del /s /q Qt5Quick3D.dll
del /s /q Qt5Quick3DAssetImport.dll
del /s /q Qt5Quick3DRender.dll
del /s /q Qt5Quick3DRuntimeRender.dll
del /s /q Qt5Quick3DUtils.dll
del /s /q Qt5QuickTest.dll
del /s /q Qt5RemoteObjects.dll
del /s /q Qt5Test.dll

echo d.dll > uncopy.txt
xcopy /Y /exclude:uncopy.txt "D:\\Qt\\5.15.2\\msvc2019_64\plugins\\sqldrivers\\" ".\\bin\\sqldrivers\\" /s
del /s /q uncopy.txt


"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" %~1%.iss
set "filename=%~1%"
set name="%filename%_cn_%curtime%.exe"
ren "%filename%_package.exe" %name%
